package com.demo.demo2;import java.net.InetSocketAddress;import java.nio.ByteBuffer;import java.nio.channels.SocketChannel;import java.util.Scanner;public class Client {    public static void main(String[] args) throws Exception {        SocketChannel sc = SocketChannel.open();        sc.connect(new InetSocketAddress("127.0.0.1",1990));        Scanner scanner = new Scanner(System.in);        ByteBuffer bb = ByteBuffer.allocate(1024);        while (true){            bb.clear();            String str = scanner.next();            bb.put(str.getBytes());            bb.flip();            sc.write(bb);        }    }}